<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>添加挂号</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-container">
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>添加挂号信息</legend>
  </fieldset>
   
  <div class="layui-row">
    <div class="layui-col-md12">
      <!-- 挂号信息 -->
	<form class="layui-form layui-form-pane " style="padding:20px"  action="" >
	
		<div class="layui-form-item">
		<div class="layui-inline">
		    <label class="layui-form-label">患者</label>
		    <div class="layui-input-inline">
		      <select name="patientId" lay-filter="patient" id="patient" lay-search="">
		        <option value=""  selected="">请选择</option>
		        <option th:each="patient:${patients}" th:value="${patient.patientId}">[[${patient.patientName}]]</option>
		        
		      </select>
		    </div>
		    </div>
		  <div class="layui-inline">
		    <label class="layui-form-label">挂号类型</label>
		    <div class="layui-input-inline">
		      <select name="regisTypeId" lay-filter="regisType" id="regisType" lay-search="">
		        <option value=""  selected="">请选择</option>
		        <option th:each="regisType:${regisTypes}" th:value="${regisType.regisTypeId}">[[${regisType.regisTypeName}]]</option>
		      </select>
		    </div>
		    </div>
		    
		  <div class="layui-inline">
		    <label class="layui-form-label">挂号科室</label>
		    <div class="layui-input-inline">
		      <select name="officeId" lay-filter="office" id="office" lay-search="">
		        <option value=""  selected="">请选择</option>
		        <option th:each="office:${offices}" th:value="${office.officeId}">[[${office.officeName}]]</option>
		        
		      </select>
		    </div>
		    </div>
		  </div>
	
		<div class="layui-inline">
		    <label class="layui-form-label">工作人员</label>
		    <div class="layui-input-inline">
		      <select name="empId" lay-filter="emp" id="emp" lay-search="">
		        <option value=""  selected="">请选择</option>
		        <option th:each="emp:${emps}" th:value="${emp.empId}">[[${emp.empName}]]</option>
		      </select>
		  </div>
		  </div>
		 
		 <div class="layui-form-item" align="center">
		    <div class="layui-input-block">
		      <button class="layui-btn" type="submit" lay-filter="submitRegisInfo" lay-submit="">提交挂号单</button>
		      <button class="layui-btn layui-btn-warm layui-icon layui-icon-refresh" type="reset">重置</button>
		    </div>
		  </div>
		
	</form>
      
    </div>
</div>
</div>

<div class="layui-container">
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 0px;">
    <legend>添加患者信息</legend>
  </fieldset>
   
  <div class="layui-row">
    <div class="layui-col-md12">
    	<!-- 患者信息 -->
	<form class="layui-form layui-form-pane " style="padding:20px"  action="" >
	
		<div class="layui-form-item">
			<label class="layui-form-label">姓名</label>
			<div class="layui-input-block">
				<input name="patientName" lay-verify="required" class="layui-input" type="text" placeholder="姓名" autocomplete="off">
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">身份证号</label>
			<div class="layui-input-block">
				<input name="patientIdcard" lay-verify="required|identity" class="layui-input" type="text" placeholder="身份证号" autocomplete="off" >
			</div>
		</div>
		
		
		 <div class="layui-form-item">
		    <label class="layui-form-label">单选框</label>
		    <div class="layui-input-block">
		      <input name="patientGender" title="男" type="radio" value="男">
		      <input name="patientGender" title="女" type="radio" value="女">
		    </div>
		  </div>
		
		<div class="layui-form-item">
		   <div class="layui-inline">
		      <label class="layui-form-label">联系方式</label>
		      <div class="layui-input-inline">
		        <input name="patientTel" lay-verify="required|phone" class="layui-input" type="tel" autocomplete="off">
		      </div>
		    </div>
		 <div class="layui-inline">
		    <label class="layui-form-label">联系地址</label>
		      <div class="layui-input-inline">
		        <input name="address" class="layui-input" type="text" autocomplete="off">
		      </div>
		    </div>
		    <div class="layui-inline">
		    <label class="layui-form-label">年龄</label>
		      <div class="layui-input-inline">
		        <input name="patientAge" class="layui-input" type="text" autocomplete="off">
		      </div>
		    </div>
		 </div>
		
		 <div class="layui-form-item" align="center">
		    <div class="layui-input-block">
		      <button class="layui-btn" type="submit" lay-filter="submitPatient" lay-submit="">添加患者</button>
		      <button class="layui-btn layui-btn-warm  layui-icon layui-icon-refresh" type="reset">重置</button>
		    </div>
		  </div>
		
	</form>
    
    </div>
  </div> 
</div>		
	

	

	<script src="../../layuiadmin/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript">
		layui.use(['element','jquery','laydate','form'],function(){
			var $ = layui.jquery;
			var element=layui.element;
			var laydate=layui.laydate;
			var form=layui.form;
			
			//监听患者表单提交
			form.on('submit(submitPatient)', function(data){
			  //console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
			  //console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
			  //console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
			  //return true; //true表示同步提交
			  $.ajax({
				  url:'/patient/patientAdd',
				  contentType:"application/json;charset=utf-8",
				  type:"post",
				  data:JSON.stringify(data.field),
				  success:function(res){
					  alert(res);
				  }
			  });
			  return false;//阻止表单跳转。如果需要表单跳转，去掉这段即可。false表示异步提交
			});
			
			//监听挂号信息提交
			form.on('submit(submitRegisInfo)',function(data){
				$.ajax({
					url:'/regisInfo/regisInfoAdd',
					contentType:'application/json;charset=utf-8',
					type:"post",
					data:JSON.stringify(data.field),
					success:function(res){
						alert(res);
					}
				});
			})
			
			
		});
	</script>
</body>
</html>